//
//  MYNewsActionSearchVC.m
//  MuYing
//
//  Created by tbb on 2019/8/6.
//  Copyright © 2019 TBB. All rights reserved.
//

#import "MYNewsActionSearchVC.h"
#import "MYShopSearchScreenHeader.h"
#import "MYNewsDetailsActionVC.h"
#import "MYNewsModel.h"
@interface MYNewsActionSearchVC ()

@end

@implementation MYNewsActionSearchVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

-(void)setupView {
    [super setupView];

    
}

- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    MYNewsGoodsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MYNewsGoodsCell"];
    MYNewsModel *newsModel = nil;
    if (indexPath.row < self.dataArr.count) {
        newsModel = self.dataArr[indexPath.row];
    }
    cell.titleLb.text = newsModel.title;
    cell.distanceLb.text = newsModel.showMi;
    cell.priceLb.textColor = HexColor(0x79C4C7);
    cell.priceLb.text = kYQLS(@"查看");
    return cell;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    MYShopSearchScreenHeader *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"MYShopSearchScreenHeader"];
    self.screenHeaderView = header;
    [header.synthesizeBtn addTarget:self action:@selector(synthesizeAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [header.sellBtn addTarget:self action:@selector(sellAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [header.screenBtn addTarget:self action:@selector(screenAction:) forControlEvents:(UIControlEventTouchUpInside)];
    header.sellBtn.hidden = YES;
    return header;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    MYNewsModel *newsModel = nil;
    if (indexPath.row < self.dataArr.count) {
        newsModel = self.dataArr[indexPath.row];
    }
    MYNewsDetailsActionVC *detailsActionVC = [[MYNewsDetailsActionVC alloc] init];
    detailsActionVC.informationCategoryId = self.categoryId;
    detailsActionVC.informationId = newsModel.Id;
    kYQPUSH(detailsActionVC);
}
@end
